/*
//-----------------------------mock接口时的类型定义 

import type { RouteRecordRaw } from "vue-router"
import type { showElement } from "@/api/friend/type"

//定义用户信息小仓库数据state类型
export interface UserState {
  token: string | null,
  menuRoutes: RouteRecordRaw[],
  username: string,
  avatar: string,
  realname: string
  friendMessage: showElement[]
}

//定义好友聊天发送每一条消息的数据state类型
export interface FriendState {
  chatInfo: showElement
}
*/

import { conversation, friend, FriendRequireItem } from '@/api/messages/type'
import { FileData } from '@/api/file/type'
import type { RouteRecordRaw } from 'vue-router'

//定义用户小仓库数据的ts类型
export interface UserState {
    userId: number
    menuRoutes: RouteRecordRaw[]
    navRoutes: RouteRecordRaw[]
    username: string
    avatar: string
    realname: string
    chatListFriends: friend[]
    friends: friend[]
    token: string | null
    changeAvatar: FileData | null
}

//定义聊天页会话路由的meta的ts类型
export interface ChatMenuItemMeta {
    userId: number
    conversationId: number
    username: string
    title: string
    avatar: string
    hidden: boolean
}

//定义消息仓库数据的ts类型
export interface MessagesState {
    conversations: conversation[]
    chattingFriend: friend | undefined
    contactsFriend: friend
    currentAudio: HTMLAudioElement | null
    audioUrl: string | null
    selectedFile: FileData | null
}

//定义WebSocket仓库的ts类型
export interface WsState {
    isConnected: boolean
    heartbeatInterval: any
    missedHeartbeats: number
    reconnectInterval: any
    callTo: boolean
    incomingCall: boolean
    iscalling: boolean
    receivedSDP: any
    videoInfo: any
    showMessage: string
    callType: string
    peer: RTCPeerConnection | null
    isRequestReconnect: boolean
    callReconnected: boolean
    newFriend: FriendRequireItem | null
    friendApply: boolean
}

//定义样式布局仓库的ts类型
export interface LayoutState {
    fold: boolean
    refresh: boolean
}

//定义错误处理仓库的ts类型
export interface ErrorState {
    errorMessage: Error | string | null
}
